<?php
namespace cms\modules\v1\controllers;

use cms\modules\common\controllers\DefaultController;
use cms\modules\v1\models\feedback\FeedbackInfo;
use cms\modules\v1\models\feedback\FeedbackType;
use cms\modules\v1\models\report\ReportCategory;
use cms\modules\v1\models\report\ReportInfo;
use Yii;
/**
 * Default controller for the `v1` module
 */
class ReportController extends DefaultController
{
    
    public $modelClass = '';

    //============================ 举报分类 ============================
    /**
     * 获取分类
     * @return array|mixed|\yii\db\ActiveRecord[]
     */
    public function actionCategoryList() {
        if (\Yii::$app->request->isGet) {
            return (new ReportCategory())->getListData();
        }
    }
    
    public function actionCategoryAddEdit($id = 0) {
        $model = new ReportCategory();
        if (\Yii::$app->request->isPost) {
            $model->setScenario('addEdit');
            if ($model->load(Yii::$app->request->post(), '')) {
                return $model->addEdit();
            }
        }
        if (\Yii::$app->request->isGet) {
            return $model->getInfo($id);
        }
    }

    public function actionCategoryField($id = 0) {
        if (\Yii::$app->request->isPost) {
            return (new ReportCategory())->setField();
        }
    }

    //============================ 反馈信息 ============================
    public function actionList($page = 1, $size = 50) {
        #获取帮助信息
        if (\Yii::$app->request->isGet) {
            return (new ReportInfo())->getListData($page, $size);
        }
    }

    
    // 删除
    public function actionDel() {
        if (\Yii::$app->request->isPost) {
            return (new ReportInfo())->multipleDelete();
        }
    }

}
